<template>
  <div class="user-info">
    <!-- 个人信息 -->
    <el-tag v-if="data.length===0 ? true:false">用户尚无角色</el-tag>
    <el-form v-for="(item,index) in data" ref="form" :key="index" :model="item" label-width="80px">
      <el-form-item label="角色">
        <el-input :value="item.name" />
      </el-form-item>
      <el-form-item label="角色功能">
        <el-input :value="item.details" />
      </el-form-item>
    </el-form>
  </div>

</template>

<script>
import { getUserRole } from '@/api/user'
export default {
  data() {
    return {
      user_id: this.$route.params.id,
      form: {
        name: ''
      },
      data: []
    }
  },
  created() {
    this.getUserRoleById()
  },
  methods: {
    async getUserRoleById() {
      this.data = await getUserRole(this.user_id)
    }
  }
}
</script>
